import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/Login.vue'),
      meta: { showNav: false } 
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('../views/Register.vue'),
      meta: { showNav: false} 
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('../views/Home.vue'),
      meta: { showNav: true }
    },
    {
      path: '/category/:categoryId',
      name: 'category',
      component: () => import('../views/Category.vue'),
      meta: { showNav: true }
    },
    {
      path: '/restaurant/:restaurantId',
      name: 'restaurant',
      component: () => import('../views/Restaurant.vue'),
      meta: { showNav: true }
    },
    {
      path: '/order/confirm',
      name: 'order-confirm',
      component: () => import('../views/OrderConfirm.vue'),
      meta: { showNav: true }
    },
    {
      path: '/payment',
      name: 'payment',
      component: () => import('../views/Payment.vue'),
      meta: { showNav: true }
    },
    {
      path: '/orders',
      name: 'orders',
      component: () => import('../views/OrderList.vue'),
      meta: { showNav: true }
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/'
    }
  ]
})



export default router